package soot.we.android.component;

import java.util.List;

import soot.we.android.callGraph.EntitySinkInf;
import soot.we.android.callGraph.EntitySourceInf;

public class LeakingPath {
	public EntitySinkInf sink;
	public List<EntitySourceInf> sourcepath;
	public LeakingPath(List<EntitySourceInf> scs,EntitySinkInf sk){
		  sourcepath = scs;
	      sink = sk;
	}
	public boolean equalTo(LeakingPath p) {
		if(!this.sink.getStmt().toString().equals(p.sink.getStmt().toString()))
			return false;
		if(!this.sourcepath.get(0).getStmt().toString().equals(p.sourcepath.get(0)
			.getStmt().toString()))
			return false;
		return true;
	}
	public boolean IsCorrectPath(EntityClass curClass) {
		// TODO Auto-generated method stub
		EntitySourceInf headsource= sourcepath.get(0);
		if(headsource.getStmt().toString().contains("android.content.Intent")){
			String classname = headsource.getClassName();
				if(classname.equals(curClass.getclassName())){
					if(!curClass.isEntryPointClass())
						return false;
				}
		}
		return true;
	}
}
